<%@ page import="com.cddeskywebsite.dao.AdminDao" %>
<%
    request.setCharacterEncoding("UTF-8");//设置编码方式为UTF-8
    String Action = request.getParameter("Action");//判断是否单机登录按钮
    if (Action!= null && Action.equals("Login")){
        String User = request.getParameter("User");//得到登录用户名
        String Pwd = request.getParameter("Pwd");//得到登录密码
        AdminDao adminDao = new AdminDao();
        boolean isOK = adminDao.CheckLogin(User, Pwd);
        if (isOK){
            out.print("<script>alert('登录成功！');location.href='news.jsp';</script>");
        }else {
            out.print("<script>alert('登陆失败！');location.href='login.jsp';</script>");
        }
    }

%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台登录-天码行空学习建站</title>
    <link rel="stylesheet" href="static/css/amazeui.min.css"/>
    <script src="static/js/main.js"></script>
</head>
<!--注释：引入背景图-->
<body style="background: url(/static/img/login-bg.png) no-repeat">
<!--注释：公司标题图片-->
<div class="header" style="text-align: center; margin-top: 100px">e
    <div class="am-g">
        <img src="static/img/loginTitle.png"/>
    </div>
</div>
<!--注释：登录框-->
<div class="am-g" style="margin-top: 20px">
    <div class="am-u-lg-6  am-u-md-10  am-u-sm-centered"
         style="background: url(static/img/loginForm.png) no-repeat; height: 479px; width: 695px">
        <!--注释：登录表单-->
        <form action="login.jsp" method="post" class="am-form login-form"
              style="padding: 50px 0px 0px 120px; width: 550px"
              onSubmit="return LoginCheck()">
            <label for="user"> 用户名: </label>
			<input type="text" name="User" id="User" value=""> <br>
			<label for="pwd"> 密码:</label>
            <input type="password" name="Pwd" id="Pwd" value=""> <br>
            <!--注释：登录按钮-->
            <div class="am-cf">
                <input name="Action" type="hidden" value="Login">
                <input
                    type="submit" value="登 录" id="save"
                    style="width: 100%; border-radius: 0.5em;"
                    class="am-btn am-btn-primary am-btn-sm am-round">
            </div>
        </form>
    </div>
</div>
</body>
</html>